package ar.com.vates.ejercicio2;

import java.util.Random;

public class Escribe implements Runnable {
 
	private Contenedor contenedor;
	
	public Escribe(Contenedor con){
		this.contenedor=con;
	}


	@Override
	public void run() {
		

			try {
				 for(int i=0;i<10;i++){
					 if(contenedor.getNumero()!=0){
				         Thread.sleep(2000);
					 }
					 Random r=new Random();
					 contenedor.setNumero(r.nextInt());
					 System.out.println("Escribe"+contenedor.getNumero());
					 
				  }								  
			     } catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	
	}